package com.slz3.business.module.configManagement.conSiteProvince.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conSiteProvince.domain.ConSiteProvince;
import com.slz3.business.module.configManagement.conSiteProvince.domain.ConSiteProvinceFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConSiteProvinceTransactionalServiceImpl implements ConSiteProvinceTransactionalService {

    @Override
    public ConSiteProvince modify(ConSiteProvince conSiteProvinceNew) {
        Repositorys.conSiteProvince.test();
        Repositorys.conSiteProvince.save(ConSiteProvinceFactory.initBaseFields());
        System.err.println(1/0);
        conSiteProvinceNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conSiteProvince.saveAndFlush(conSiteProvinceNew);
    }

    @Override
    public List<ConSiteProvince> batchModify(List<ConSiteProvince> conSiteProvinceList) {
        return Repositorys.conSiteProvince.saveAll(conSiteProvinceList);
    }
}
